package com.spark.sparkanswerserver.domain;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.neo4j.core.schema.GeneratedValue;
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Property;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.List;

/**
 * @version 1.0
 * @Author Xing
 * @Date 2023/2/21 5:54
 */
@org.springframework.data.neo4j.core.schema.Node( "health")
@NoArgsConstructor
@AllArgsConstructor
public class Node {
    @Id
    @GeneratedValue
    private Long id;

    @Property(name = "name")
    private String name;

    @Relationship(type = "主治",value = "主治",direction = Relationship.Direction.INCOMING)
    private List<Node> reason;
    @Relationship(type = "主治",value = "主治",direction = Relationship.Direction.OUTGOING)
    private List<Node> result;

    public Node(Long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Node(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<Node> getReason() {
        return reason;
    }

    public void setReason(List<Node> reason) {
        this.reason = reason;
    }

    public List<Node> getResult() {
        return result;
    }

    public void setResult(List<Node> result) {
        this.result = result;
    }

    @Override
    public String toString() {
        return "Node{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", reason=" + reason +
                ", result=" + result +
                '}';
    }
}
